Reversing a Related Attribute
Overview
Occasionally, a relationship between two entities is defined as a Related Attribute relationship.
This relationship allows visibility from one entity, but not the other.
In this case, an instance of Entity A has one Stakeholder related, but the Stakeholder does not have any relationship with Entity A instances.
This situation may lead to unnavigable Xpaths and finally a process hard to automate.
Bizagi allows the data designer to reuse the relationship already defined to create a new one-to-many relationship.
This allows both entities to navigate through each other. Therefore, the design becomes easily navigable through Xpaths.
Once the relationship is configured:
- Each Stakeholder instance will have one or many instances related to Entity A.
- Entity A will be aware of its relationship with the Stakeholder instance.
This procedure avoids the loss of data already stored in the database, making it ideal to redefine a relationship previously deployed.
note_pin
In case you only need navigability to display collections in the My Stuff section of the Me Menu in the Work Portal,
consider using Indirect Collections instead of reversing a related attribute.
Re-utilization Procedure
Having two entities with a Related Attribute relationship,
create a new one-to-many relationship from the entity with any visibility over the other entity.
In this case, a Cargo in the data model has been defined as related with a Freight Dispatch.
Nonetheless, we want every Freight Dispatch instance to be related to all its corresponding Cargo instances,
making it easier to navigate with Xpaths through the data model.
Steps:
-
Right-click the entity with no navigation, in this case, Freight Dispatch, and select Edit attributes.
-
Add a new collection of the entity Cargo.
-
Once the entity Cargo is selected, a window will appear prompting if you want to reuse the foreign key stored in the entity Cargo.
- Select the attribute (the attribute displayed has been defined in the entity Cargo).
- Finally, select OK to save.
Now, a new one-to-many relationship replaces the previous one,
and the foreign keys stored in the entity Cargo are being reused in this relationship.